{% extends "base.html" %}
{% import "_my_wtf_macros.html" as my_wtf_macros %}

{% block title %}万屏时代OPC--导入工程商{% endblock %}

{% block panel_heading %}万屏时代OPC--导入工程商{% endblock %}

{% block panel_body %}
    <form id="import-user-form" action="{{ action }}"
          method="post" enctype="multipart/form-data" onsubmit="return on_submit()">

        <div class="well well-sm">文件信息</div>
        {{ form.hidden_tag() }}
        {{ my_wtf_macros.form_field(form.files, div_col=4, label_col=4, field_col=7) }}

        <div class="pull-right">
            <button type="submit" class="btn btn-success"
                    id="import-btn">
                导入
            </button>
        </div>

        {% if error_msg %}
            <table id="error-info-table"
                   class="table table-bordered table-hover table-condensed table-striped">
                <thead>
                <tr>
                    <th>行号</th>
                    <th>错误信息</th>
                </tr>
                </thead>
                <tbody>
                {% for error in error_msg %}
                    <tr>

                        <td class="text-danger">{{ error[0] }}</td>
                        <td class="text-danger">{{ error[1] }}</td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        {% endif %}

    </form>

{% endblock %}

{% block scripts %}
    {{ super() }}
    <script>
          var is_submit = false;
          function on_submit() {
              if(is_submit){
                  return false
              }
              else{
                  is_submit = true;
                  return true
              }
          }
    </script>


{% endblock %}

